﻿Imports System.Data.OleDb

Public Class aspnet_UsersManagement
    Inherits ConnectionClass

    Public Function SelectTopASPNETUser() As Int32
        Try

            myConnection.Open()
            Dim Cmd As OleDbCommand = New OleDbCommand("Select Top 1 UserId from aspnet_Users Order By UserId Desc", myConnection)
            Dim dr = Cmd.ExecuteReader()
            dr.Read()
            Dim lastId = dr.GetValue(0)
            myConnection.Close()
            Return lastId

        Catch ex As Exception
            Return Nothing
        End Try
    End Function


    Public Function SelectUserIDByUsername(ByVal userName As String) As Int32
        Try

        
        myConnection.Open()
        Dim Cmd As OleDbCommand = New OleDbCommand("Select Top 1 UserId from aspnet_Users where UserName = @f1", myConnection)
        Cmd.Parameters.AddWithValue("@f1", userName)
        Dim dr = Cmd.ExecuteReader()
        dr.Read()
        Dim userId = dr.GetValue(0)
        myConnection.Close()
            Return userId
        Catch ex As Exception
            Return Nothing
        End Try
    End Function


  
    


End Class
